package BVRClient;

/**
 * The Blue vs Red: Arena Entity Class.
 * @author Jesse Gill
 * @author Shannon Setter
 */
public class BVRC_Entity
{
	protected BVRC_Rect entityRect = new BVRC_Rect(0, 0, 0, 0);
	
	/**
	 * 
	 */
	public BVRC_Entity() {}
	
	/**
	 * 
	 * @param p
	 * @return true if there is a collision, false if not
	 */
	public boolean pointCollision(BVRC_Point p)
	{
		return p.rectCollision(this.entityRect);
	}
	
	/**
	 * 
	 * @param e
	 * @return true if there is a collision, false if not
	 */
	public boolean entityCollision(BVRC_Entity e)
	{
		return this.entityRect.rectCollision(e.getEntityRect());
	}
	
	/**
	 * 
	 * @param x
	 * @param y
	 */
	public void offsetPosition(float x, float y)
	{
		this.entityRect.x += x;
		this.entityRect.y += y;
	}
	
	/**
	 * 
	 * @param x
	 * @param y
	 */
	public void setPosition(int x, int y)
	{
		this.entityRect.x = x;
		this.entityRect.y = y;
	}
	
	/**
	 * 
	 * @param p
	 */
	public void setPosition(BVRC_Point p)
	{
		this.entityRect.x = p.x;
		this.entityRect.y = p.y;
	}
	
	/**
	 * 
	 * @return the entity's current position
	 */
	public BVRC_Point getPosition()
	{
		return new BVRC_Point(this.entityRect.x, this.entityRect.y);
	}
	
	/**
	 * 
	 * @param entityRect
	 */
	public void setEntityRect(BVRC_Rect entityRect)
	{
		this.entityRect = entityRect;
	}
	
	/**
	 * 
	 * @return a rect describing the entity's position and size
	 */
	public BVRC_Rect getEntityRect()
	{
		return this.entityRect;
	}
}
